divert(-1)
changecom(/*, */)
/*
 * Copyright (c) 2000-2002 Apple Inc. All Rights Reserved.
 * 
 * The contents of this file constitute Original Code as defined in and are
 * subject to the Apple Public Source License Version 1.2 (the 'License').
 * You may not use this file except in compliance with the License. Please obtain
 * a copy of the License at http://www.apple.com/publicsource and read it before
 * using this file.
 * 
 * This Original Code and all software distributed under the License are
 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
 * specific language governing rights and limitations under the License.
 */

define(`startClass',
`define(`indexIndex', 0)dnl
define(`class', $1)dnl
divert(2)dnl
// $1 attributes
const CSSM_DB_SCHEMA_ATTRIBUTE_INFO $1SchemaAttributeList[] =
{
divert(3)dnl
// $1 indices
const CSSM_DB_SCHEMA_INDEX_INFO $1SchemaIndexList[] =
{')

define(`endClass',
`divert(2)dnl
};

const uint32 class()SchemaAttributeCount = sizeof(class()SchemaAttributeList) / sizeof(CSSM_DB_SCHEMA_ATTRIBUTE_INFO);

divert(3)dnl
`    // Unique (primary) index'
undivert(5)
`    // Secondary indices'
undivert(6)dnl
};

const uint32 class()SchemaIndexCount = sizeof(class()SchemaIndexList) / sizeof(CSSM_DB_SCHEMA_INDEX_INFO);

undivert(4)dnl
divert(0)dnl
undivert(1)dnl
undivert(2)dnl
undivert(3)dnl')

define(`attributeBody',
`{
ifelse(index(`$1',`s'),-1,
`    CSSM_DB_ATTRIBUTE_NAME_AS_INTEGER,
    {(char *)((uint64_t)$3<<32|$3)},',
`    CSSM_DB_ATTRIBUTE_NAME_AS_STRING,
    {$4},')
    CSSM_DB_ATTRIBUTE_FORMAT_$7
}')

define(`simpleAttribute',
`const CSSM_DB_ATTRIBUTE_INFO $2 =
attributeBody($*);
')

define(`attribute',
`divert(2)dnl
    { $3, (char*) $4, { $5, $6 }, CSSM_DB_ATTRIBUTE_FORMAT_$7 },
divert(-1)
ifelse(index(`$1',`S'),-1,`',
`divert(4)dnl
simpleAttribute($*)
divert(-1)')dnl

ifelse(index(`$1',`U'),-1,`',
`divert(5)dnl
    { $3, 0, CSSM_DB_INDEX_UNIQUE, CSSM_DB_INDEX_ON_ATTRIBUTE },
divert(-1)')dnl
ifelse(index(`$1',`I'),-1,`',
`define(`indexIndex', incr(indexIndex))dnl
divert(6)dnl
    { $3, indexIndex(), CSSM_DB_INDEX_NONUNIQUE, CSSM_DB_INDEX_ON_ATTRIBUTE },
divert(-1)')')

/* Start of actual output */
divert(0)dnl
/*
 * Generated by m4 from KeySchema.m4 please do not edit this file.
 */

`#include <security_cdsa_utilities/KeySchema.h>'
#include <Security/SecKey.h>

namespace KeySchema {

divert(-1)
startClass(Key)
attribute(`  Ss', KeyClass, kSecKeyKeyClass, (char*) "KeyClass", 0, NULL, UINT32)
attribute(`  Ss', PrintName, kSecKeyPrintName, (char*) "PrintName", 0, NULL, BLOB)
attribute(`  Ss', Alias, kSecKeyAlias, (char*) "Alias", 0, NULL, BLOB)
attribute(`  Ss', Permanent, kSecKeyPermanent, (char*) "Permanent", 0, NULL, UINT32)
attribute(`  Ss', Private, kSecKeyPrivate, (char*) "Private", 0, NULL, UINT32)
attribute(`  Ss', Modifiable, kSecKeyModifiable, (char*) "Modifiable", 0, NULL, UINT32)
attribute(`UISs', Label, kSecKeyLabel, (char*) "Label", 0, NULL, BLOB)
attribute(`U Ss', ApplicationTag, kSecKeyApplicationTag, (char*) "ApplicationTag", 0, NULL, BLOB)
attribute(`U Ss', KeyCreator, kSecKeyKeyCreator, (char*) "KeyCreator", 0, NULL, BLOB)
attribute(`U Ss', KeyType, kSecKeyKeyType, (char*) "KeyType", 0, NULL, UINT32)
attribute(`U Ss', KeySizeInBits, kSecKeyKeySizeInBits, (char*) "KeySizeInBits", 0, NULL, UINT32)
attribute(`U Ss', EffectiveKeySize, kSecKeyEffectiveKeySize, (char*) "EffectiveKeySize", 0, NULL, UINT32)
attribute(`U Ss', StartDate, kSecKeyStartDate, (char*) "StartDate", 0, NULL, BLOB)
attribute(`U Ss', EndDate, kSecKeyEndDate, (char*) "EndDate", 0, NULL, BLOB)
attribute(`  Ss', Sensitive, kSecKeySensitive, (char*) "Sensitive", 0, NULL, UINT32)
attribute(`  Ss', AlwaysSensitive, kSecKeyAlwaysSensitive, (char*) "AlwaysSensitive", 0, NULL, UINT32)
attribute(`  Ss', Extractable, kSecKeyExtractable, (char*) "Extractable", 0, NULL, UINT32)
attribute(`  Ss', NeverExtractable, kSecKeyNeverExtractable, (char*) "NeverExtractable", 0, NULL, UINT32)
attribute(` ISs', Encrypt, kSecKeyEncrypt, (char*) "Encrypt", 0, NULL, UINT32)
attribute(` ISs', Decrypt, kSecKeyDecrypt, (char*) "Decrypt", 0, NULL, UINT32)
attribute(` ISs', Derive, kSecKeyDerive, (char*) "Derive", 0, NULL, UINT32)
attribute(` ISs', Sign, kSecKeySign, (char*) "Sign", 0, NULL, UINT32)
attribute(` ISs', Verify, kSecKeyVerify, (char*) "Verify", 0, NULL, UINT32)
attribute(` ISs', SignRecover, kSecKeySignRecover, (char*) "SignRecover", 0, NULL, UINT32)
attribute(` ISs', VerifyRecover, kSecKeyVerifyRecover, (char*) "VerifyRecover", 0, NULL, UINT32)
attribute(` ISs', Wrap, kSecKeyWrap, (char*) "Wrap", 0, NULL, UINT32)
attribute(` ISs', Unwrap, kSecKeyUnwrap, (char*) "Unwrap", 0, NULL, UINT32)
endClass()

} // end namespace KeySchema
